<template>
  <div>
    <div style="display: flex;align-items: center;justify-content: center;">
      <el-card style="width: 80%;margin-top: 30px">
        <div style="margin-bottom: 10px;margin-left:5px;font-size: 20px;font-weight: bold;">活动参与用户</div>
        <div style="margin-bottom: 20px">
        </div>
        <el-table ref="userTable" :data="tableData" stripe
                  :header-cell-style="{backgroundColor:'aliceblue',color:'#666'}">
          <el-table-column prop="activity_id" label="活动id"></el-table-column>
          <el-table-column prop="hotel_name" label="酒店名称"></el-table-column>
          <el-table-column prop="num" label="参与人数"></el-table-column>
        </el-table>
        <div style="margin: 10px 0">
          <el-pagination
              @current-change="handleCurrentChange"
              :current-page="page_id"
              :page-sizes="[100, 200, 300, 400]"
              :page-size="page_size"
              layout="total,  prev, pager, next"
              :total="page_total">
          </el-pagination>
        </div>
      </el-card>
    </div>
  </div>
</template>

<script>
export default {
  name: "number",
  data() {
    return {
      user: JSON.parse(localStorage.getItem('user') || '{}'),
      tableData: [],
      page_id: 1,//当前的页码
      page_size: 5,//每页显示的个数
      page_total: 0,
      user_id: "",
    }
  },
  methods: {
    load(page_id) {  //分页查询
      if (page_id) this.page_id = page_id
      this.$request.post('/activity_user_count/').then(res => {
        if (res.code === '200') {
          this.tableData = res.data
          this.page_total = res.data
          console.log("查询酒店详情", res.data)
        } else {
          this.$message.error(res.msg)
        }
      })
    },
    handleCurrentChange(page_id) {//下一页
      this.load(page_id)
    },
  },
  created() {
    this.load()
  }
}
</script>

<style scoped>

</style>